/*
 * @Author: zhangweinan
 * @Date: 2023-07-17 14:27:07
 * @LastEditors: Hzt
 * @LastEditTime: 2024-11-27 21:22:20
 * @Description: file content
 * @FilePath: \cty_admin\src\api\deviceManage.js
 */
import request, { post, get } from "@/utils/request";

//查询用户绑定设备在线状态
export function fetchDeviceOnlineStatus(params) {
  return get("/device/queryDeviceOnlineByUser", params);
}

//查询设备实时信息
export function fetchDeviceRealTimeInfo(params) {
  return get("/device/queryDeviceRealTimeInfo", params);
}

//新建设备
export function fetchSaveDevice(params) {
  return post("/device/save", params);
}

//设备删除
export function fetchDeleteDevice(params) {
  return post(`/device/delete?id=${params.id}`);
}

//设备划拨保存
export function fetchSaveDeviceTransfer(id, userId) {
  return post(`/device/deviceAllocate?sns=${id}&userId=${userId}`);
}

//下载模版
export function fetchDownloadTemplate(brandId) {
  return request({
    url: `/device/templateDownload?brandId=${brandId}`,
    responseType: "blob",
  });
}

//批量导入
export function fetchBatchImport(params) {
  return post("/device/deviceImport", params);
}
//解绑
export function recovery(params) {
  return post(`/device/recovery`, params);
}

//编辑分组
export function editGroup(params) {
  return post(`/device/group/edit`, params);
}

//获取分组列表
export function myGroup(params) {
  return get(`/device/group/myGroup`, params);
}

//获取压测结果
export function pressureTestResult(sn) {
  return get(`/device/pressureTestResult/${sn}`);
}
//获取拨号结果
export function dialing(sn) {
  return get(`/device/dialing/${sn}`);
}

export function switchDispatchTypeReq(params) {
  return post(`/device/dispatchType`,params); 
}
